from views.blog import PostView, TagView, IndexView, CommentView
from views.management import AuthorLoginView, AuthorView, ManagementView, PostManageView, CategoryManageView, \
                             TagManageView

handlers = [
    # 后台管理
    (r"/author/login", AuthorLoginView.LoginHandler),
    (r"/author/logout", AuthorLoginView.LogoutHandler),
    (r"/author/info", AuthorView.AuthorHandler),
    (r"/manage/index", ManagementView.IndexHandler),
    (r"/manage/post", PostManageView.PostHandler),
    (r"/manage/post/detail/(.*)", PostManageView.PostDetailHandler),
    (r"/manage/write_post", PostManageView.NewPostHandler),
    (r"/manage/category", CategoryManageView.CategoryHandler),
    (r"/manage/tags", TagManageView.TagHandler),
    (r"/api/index_data", ManagementView.IndexHandler),
    (r"/api/update_author_info", AuthorView.AuthorHandler),
    (r"/api/new_post", PostManageView.NewPostHandler),
    (r"/api/post_data", PostManageView.PostHandler),
    (r"/api/update_post", PostManageView.PostDetailHandler),
    (r"/api/del_post", PostManageView.PostHandler),
    (r"/api/category_data", CategoryManageView.CategoryHandler),
    (r"/api/new_category", CategoryManageView.CategoryHandler),
    (r"/api/update_category", CategoryManageView.CategoryHandler),
    (r"/api/del_category", CategoryManageView.CategoryHandler),
    (r"/api/tag_data", TagManageView.TagHandler),
    (r"/api/new_tag", TagManageView.TagHandler),
    (r"/api/update_tag", TagManageView.TagHandler),
    (r"/api/del_tag", TagManageView.TagHandler),

    # 博客
    (r"/", PostView.PostIndexHandler),
    (r"/blog/(.*)", PostView.PostDetailHandler),
    (r"/comment/list", CommentView.CommentHandler),
    (r"/api/add_comment", CommentView.CommentHandler),

    (r".*", IndexView.OtherHandler),

]
